package swa2012.telco.provider;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import swa2012.telco.broker.beans.*;
/**
 * @author kumar aberer
 * @date 10.06.2012
 */
public class ClientStorage {

	private final Map<String, Client> clients = new ConcurrentHashMap();

	public boolean addClient(Client client){
		if (client != null)
		{
			clients.put(client.getID(), client);
			return true;
		}

		return false;
	}

	public boolean removeClient(String clientID)
	{
		if(clients.containsKey(clientID))
			return clients.remove(clientID) != null;

		return false;
	}

	public Collection<Client> getClients(){
		System.out.println("size:" + clients.size());
		
		return clients.values();

	}

	public boolean containsClient(String clientID){
		return clients.containsKey(clientID);
	}
}
